---
title: Workspaces router
description: An overview of the workspaces router
---

## Procedures

The workspaces router has the following procedures:

### Create a workspace

Create a new workspace.

- Access: `@protected`

```typescript
// Client components
const { data } = api.workspaces.create.useMutation()

// Server components
const data = await api.workspaces.create()
```

### Check if slug is available

Check if a workspace slug is available.

- Access: `@protected`

```typescript
// Client components
const { data } = api.workspaces.slugAvailable.useQuery({ slug: 'my-workspace' })

// Server components
const data = await api.workspaces.slugAvailable({ slug: 'my-workspace' })
```

### Get workspace by slug

Get a workspace by its slug and returns the workspace details, subscription, members and tags.

- Access: `@member`

```typescript
// Client components
const { data } = api.workspaces.get.useQuery({ slug: 'my-workspace' })

// Server components
const data = await api.workspaces.get({ slug: 'my-workspace' })
```

### Update workspace

Update a workspace.

- Access: `@admin`

```typescript
// Client components
const { data } = api.workspaces.update.useMutation()

// Server components
const data = await api.workspaces.update()
```
